<header class="d-header">
    <div class="d-logo-container">
        <a class="mobile-side-switch-btn" href="javascript:;"><i class="fa fa-bars"></i></a>
        <a href="/">
            <img src="#option('WEB_LOGO','/static/public/images/favicon.ico')" height="40px">
            <span class="d-logo-text">#option('WEB_NAME','未设置')</span>
        </a>
    </div>
    <div class="d-nav-container">
        <nav class="d-header-nav">
            <div class="d-search-box">
                <form action="/article/search" method="get">
                    <a href="javascript:;" class="d-search-icon">
                        <i class="fa fa-search" aria-hidden="true"></i>
                    </a>
                    <input type="text" placeholder="搜索文章" name="title" class="d-search-input">
                </form>
            </div>
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item">
                    <a href="/" class="d-nav-item" data-href="/"><i class="fa fa-home"></i>首页</a>
                </li>

                #categories()
                    #if(categories != null && categories.size() > 0)
                        <li class="layui-nav-item">
                            <a href="javascript:;" data-href="/categories" class="d-nav-item"><i class="fa fa-th-large"></i>分类&nbsp;</a>
                            <dl class="layui-nav-child">
                                #for(category: categories)
                                    <dd><a href="#(category.url)">#(category.name ??)</a></dd>
                                #end
                            </dl>
                        </li>
                    #end
                #end

                #menus()
                    #for(menu : menus)
                        <li class="layui-nav-item">
                            <a href="#(menu.url ??)" data-href="#(menu.url ??)" target="#(menu.target == 0 ? '_self' : '_blank')" class="d-nav-item">
                                <i class="fa #(menu.icon ??)"></i>#(menu.name ??)
                            </a>
                            #if(menu.childMenu !=null && menu.childMenu.size() > 0)
                                <dl class="layui-nav-child">
                                    #for(children: menu.childMenu)
                                        <dd><a href="#(children.url)" target="#(children.target == 0 ? '_self' : '_blank')"> #(children.name ??)</a></dd>
                                    #end
                                </dl>
                            #end
                        </li>
                    #end
                #end
                #if(loginUser)
                    <li class="layui-nav-item">
                        <a href="javascript:;">
                            <img src=" #(isBlank(loginUser.avatar) ? '/static/public/images/user.png': loginUser.avatar)?s=32" alt="" class="user-img"> #(loginUser.userName ??)
                        </a>
                        <dl class="layui-nav-child">
                            #if(loginUser.hasAdmin())
                                <dd><a href="/admin"><i class="fa fa-briefcase"></i> 后台管理</a></dd>
                            #end
                            <dd><a href="/logout" data-pjax="no"><i class="fa fa-sign-out"></i> 退出登录</a></dd>
                        </dl>
                    </li>
                #else
                    <li class="layui-nav-item">
                        <a href="/login" class="d-nav-item"><i class="fa fa-sign-in"></i>登录</a>
                    </li>
                #end
            </ul>
        </nav>
    </div>
</header>

<div class="mobile-side">
    <div class="d-mobile-side">
        <div class="d-web-user-info-box">
            <img src="#option('PERFREE_WEB_RIGHT_LOGO','/static/themes/default/static/imgs/user.png')" width="80px" height="80px">
            <p>#option('PERFREE_WEB_NAME','未设置')</p>
            <div class="d-web-count">
                #statistics()
                <div class="d-count-box">
                    <span>#(statistics.articleCount)</span>
                    <span>文章</span>
                </div>

                <div class="d-count-box">
                    <span>#(statistics.commentCount)</span>
                    <span>评论</span>
                </div>
                #end
            </div>
        </div>


        <ul class="layui-nav layui-nav-tree" lay-filter="">
            <li class="layui-nav-item">
                <a href="/" class="d-nav-item" data-href="/"><i class="fa fa-home"></i>首页</a>
            </li>

            #categories()
                #if(categories != null && categories.size() > 0)
                    <li class="layui-nav-item">
                        <a href="javascript:;" data-href="/categories" class="d-nav-item"><i class="fa fa-th-large"></i>分类&nbsp;</a>
                        <dl class="layui-nav-child">
                            #for(category: categories)
                            <dd><a href="#(category.url)">#(category.name ??)</a></dd>
                            #end
                        </dl>
                    </li>
                #end
            #end

            #menus()
                #for(menu : menus)
                    <li class="layui-nav-item">
                        <a href="#(menu.url ??)" data-href="#(menu.url ??)" target="#(menu.target == 0 ? '_self' : '_blank')" class="d-nav-item">
                            <i class="fa #(menu.icon ??)"></i>#(menu.name ??)
                        </a>
                        #if(menu.childMenu !=null && menu.childMenu.size() > 0)
                            <dl class="layui-nav-child">
                                #for(children: menu.childMenu)
                                    <dd><a href="#(children.url)" target="#(children.target == 0 ? '_self' : '_blank')"> #(children.name ??)</a></dd>
                                #end
                            </dl>
                        #end
                    </li>
                #end
            #end
            #if(loginUser)
                <li class="layui-nav-item">
                    <a href="javascript:;" class="d-nav-item">
                        <i class="fa fa-user-o"></i>#(loginUser.userName ??)
                    </a>
                    <dl class="layui-nav-child">
                        #if(loginUser.hasAdmin())
                            <dd><a href="/admin">后台管理</a></dd>
                        #end
                        <dd><a href="/logout" data-pjax="no">退出登录</a></dd>
                    </dl>
                </li>
            #else
                <li class="layui-nav-item">
                    <a href="/login" class="d-nav-item"><i class="fa fa-sign-in"></i>登录</a>
                </li>
            #end
        </ul>
    </div>
    <div class="d-mask"></div>
</div>